
public class CS576_HW2_Part1 {
	public static void main(String[] args)
	{
		double[][] fxy = new double[8][8];
		
		double[][] fuv = new double[8][8];
		
		fxy[0][0] = 188;
		fxy[0][1] = 180;
		fxy[0][2] = 155;
		fxy[0][3] = 149;
		fxy[0][4] = 179;
		fxy[0][5] = 116;
		fxy[0][6] = 86;
		fxy[0][7] = 96;
		
		fxy[1][0] = 168;
		fxy[1][1] = 179;
		fxy[1][2] = 168;
		fxy[1][3] = 174;
		fxy[1][4] = 180;
		fxy[1][5] = 111;
		fxy[1][6] = 86;
		fxy[1][7] = 95;
		
		fxy[2][0] = 150;
		fxy[2][1] = 166;
		fxy[2][2] = 175;
		fxy[2][3] = 189;
		fxy[2][4] = 165;
		fxy[2][5] = 101;
		fxy[2][6] = 88;
		fxy[2][7] = 97;
		
		fxy[3][0] = 163;
		fxy[3][1] = 165;
		fxy[3][2] = 179;
		fxy[3][3] = 184;
		fxy[3][4] = 135;
		fxy[3][5] = 90;
		fxy[3][6] = 91;
		fxy[3][7] = 96;
		
		fxy[4][0] = 170;
		fxy[4][1] = 180;
		fxy[4][2] = 178;
		fxy[4][3] = 144;
		fxy[4][4] = 102;
		fxy[4][5] = 87;
		fxy[4][6] = 91;
		fxy[4][7] = 98;
		
		fxy[5][0] = 175;
		fxy[5][1] = 174;
		fxy[5][2] = 141;
		fxy[5][3] = 104;
		fxy[5][4] = 85;
		fxy[5][5] = 83;
		fxy[5][6] = 88;
		fxy[5][7] = 96;
		
		fxy[6][0] = 153;
		fxy[6][1] = 134;
		fxy[6][2] = 105;
		fxy[6][3] = 82;
		fxy[6][4] = 83;
		fxy[6][5] = 87;
		fxy[6][6] = 92;
		fxy[6][7] = 96;
		
		fxy[7][0] = 117;
		fxy[7][1] = 104;
		fxy[7][2] = 86;
		fxy[7][3] = 80;
		fxy[7][4] = 86;
		fxy[7][5] = 90;
		fxy[7][6] = 92;
		fxy[7][7] = 103;
		
		double cu;
		double cv;
		
		for(int i = 0; i < 8; i++)//u
		{
			for(int j = 0; j < 8; j++)//v
			{
				fuv[i][j] = 0;
				
				for(int k = 0; k < 8; k++)//x
				{
					for(int l = 0; l < 8; l++)//y
					{
						if(i == 0) cu = 1/(Math.sqrt(2));
						else cu = 1;
						if(j == 0) cv = 1/(Math.sqrt(2));
						else cv = 1;
						//System.out.println("cu = " + cu + ", cv = " + cv);
						
						fuv[i][j] += 0.25 * cu * cv * fxy[k][l] * (Math.cos((2 * k + 1) * i * Math.PI/16)) * (Math.cos((2 * l + 1) * j * Math.PI/16));
						
					}
				}
				
				//System.out.print("f" + i + "," + j + " " + Math.round(fuv[i][j]) + "  ");
				System.out.print(Math.round(fuv[i][j])/100 + "   ");
			}
			
			System.out.print("\n");
		}				
	}
}
